import request from '@/utils/request'

// 查询消费详细列表
export function listDetails(query) {
  return request({
    url: '/project/details/list',
    method: 'get',
    params: query
  })
}

// 查询消费详细详细
export function getDetails(ID) {
  return request({
    url: '/project/details/' + ID,
    method: 'get'
  })
}

// 新增消费详细
export function addDetails(data) {
  return request({
    url: '/project/details',
    method: 'post',
    data: data
  })
}

// 修改消费详细
export function updateDetails(data) {
  return request({
    url: '/project/details',
    method: 'put',
    data: data
  })
}

// 删除消费详细
export function delDetails(ID) {
  return request({
    url: '/project/details/' + ID,
    method: 'delete'
  })
}


//分单
export function getfendan(ids, leftid,rightid,note5) {
  return request({
    url: `/project/gsdetails/fendan/${leftid}/${rightid}`,
    method: 'post',
    data: {
      ids,
      note5
    }
  })
}

export function uploadFile(file) {
  const formData = new FormData(); // 创建 FormData 对象
  formData.append('file', file); // 将文件添加到 FormData 中
  return request({
    url: '/project/zxm/api/upload',
    method: 'post',
    data: formData, // 将 FormData 对象作为请求的 data 参数
    headers: { // 设置请求头，指定请求为多部分请求
      'Content-Type': 'multipart/form-data'
    }
  });
}

export function updateFile(data) {
  return request({
    url: '/project/zxm/api/process/',
    method: 'post',
    data: data,
  })
}
